package com.qiangesoft.miniapp.enums;

/**
 * 用户状态枚举
 *
 * @author qiangesoft
 * @date 2024-07-17
 */
public enum UserStatusEnum {

    ENABLE(1, "启用"),

    DISABLE(2, "禁用");

    Integer code;

    String name;

    UserStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static UserStatusEnum fromCode(Integer code) {
        for (UserStatusEnum value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }

}
